<h2><%=h @post.title %></h2>

<p class="post-info">Filed under <%= link_and_join(@post.tags, ', ') %></p>

<div class="post-body">
  <%= simple_format(h(@post.body)) %>
</div>

<p class="postmeta">
  <%= link_to(pluralize(@post.approved_comments.size, 'Comment'), '#comments', :class => 'comments') %> |
  <span class="date"><%= @post.created_at.to_s(:short_ordinal) %></span> |
  <%= link_to 'Add a comment', '#add-comment' %>
</p>

<a name="comments"></a><h3 id="comments"><%= pluralize(@post.approved_comments.size, 'Response') %></h3>

<ol class="commentlist">
  <% @post.approved_comments.each do |comment| %>
    <li class="<%= cycle('alt', '') %>" id="comment-<%= comment.id %>">
      <cite>
        <img alt="" src="/images/gravatar.jpg" class="avatar" height="40" width="40" />
        <%= link_to_unless(comment.author_url.nil?, comment.author_name, comment.author_url) do
          comment.author_name
        end %> says:<br />
        <span class="comment-data">
          <%= comment.created_at.to_s(:short_ordinal) %>
        </span>
      </cite>
      <div class="comment-text">
        <%= simple_format(comment.content) %>
      </div>
    </li>
  <% end %>
</ol>

<a name="add-comment"></a><h3 id="respond">Add a Comment</h3>

<% form_for(:comment, @comment, :url => {:action => 'add_comment', :id => @post.id}) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :author_name %> (required)<br />
    <%= f.text_field :author_name,
      :value => @comment.author_name || 'Your Name...',
      :onfocus => "this.value=(this.value=='Your Name...') ? '' : this.value;",
      :onblur => "this.value=(this.value=='') ? 'Your Name...' : this.value;",
      :tabindex => '1' %>
  </p>
  <p>
    <%= f.label :author_email %> (required)<br />
    <%= f.text_field :author_email,
      :value => @comment.author_email || 'Your Email...',
      :onfocus => "this.value=(this.value=='Your Email...') ? '' : this.value;",
      :onblur => "this.value=(this.value=='') ? 'Your Email...' : this.value;",
      :tabindex => '2' %>
  </p>
  <p>
    <%= f.label :author_url %><br />
    <%= f.text_field :author_url,
      :value => @comment.author_url || 'Your Website...',
      :onfocus => "this.value=(this.value=='Your Website...') ? '' : this.value;",
      :onblur => "this.value=(this.value=='') ? 'Your Website...' : this.value;",
      :tabindex => '3' %>
  </p>
  <p>
    <%= f.label :content %> (required)<br />
    <%= f.text_area :content,
      :value => @comment.content || 'Your Message...',
      :onfocus => "this.value=(this.value=='Your Message...') ? '' : this.value;",
      :onblur => "this.value=(this.value=='') ? 'Your Message...' : this.value;",
      :size => '20x10', :tabindex => '4' %>
  </p>
  <div id="recaptcha" style="margin-top:10px" align="center">
  <%# :theme => red, white, blackglass, clean, custom %>
    <%= recaptcha_tags :display => {:theme => 'blackglass', :tabindex => '6'} %>
  </div>
  <p class="no-border">
    <%= submit_tag 'Submit', :class => 'button', :tabindex => '5' %>
  </p>
<% end %>